package com.itheima.d1_thread_api;

/**
 * 目标：掌握sleep方法,join方法的作用。
 */
public class ThreadTest2 {
    public static void main(String[] args) throws InterruptedException {
        /*for (int i = 10; i > 0; i--) {
            System.out.println(i);
            Thread.sleep(1000); //让线程休眠1000毫秒（即1秒）
        }
        System.out.println("发射～");*/


        //join 可以等待线程执行完毕
        Thread t1 = new Thread(() -> System.out.println("A"));
        Thread t2 = new Thread(() -> System.out.println("B"));
        Thread t3 = new Thread(() -> System.out.println("C"));
        t1.start();
        t1.join(); //等待t1线程执行完毕
        t2.start();
        t2.join(); //等待t2线程执行完毕
        t3.start();
    }
}


